<style type="text/css">
    .tk-upper {
        text-align: center;
        display: block;
        width: 100%;
        clear: both;
        font-size: x-large;
        color: black;
        margin-top: 6.5px;
    }

    .tt1 {
        margin-top: 32px;
    }

    .tt2 {
        margin-top: 4px;
    }

    .tk-upper .tahukahkamu {
        font-size: 2.0000em; /* 24px */
        font-weight: bolder;
        color: black;        
        font-family: Serif;
    }

    .tk-upper .jumlahkab {
        font-size: 1.6667em; /* 20px */
        font-weight: bolder;
        font-family: Serif;
        color:darkorange;
    }

    .tk-upper .kenapa {
        font-size: 1.6667em; /* 20px */
        font-family: Serif;
        font-weight: bolder;
        color: red;
    }

    .page .content {
        background-color: #FFE;
        padding: 2em 0px;
    }

    .content-container {
        margin: 0;
    }

    .tk-map {
        text-align: center;
        display: block;
        width: 100%;
        height: 289px;
        /* background-image: url("<?php echo res_url("img/indonesia map 800px.png"); ?>"); */
        background-size: 100%;
        clear: both;
        margin-top: 8px;
    }

    .tk-catatan {
        display: block;
        clear: both;
        width: 700px;
        font-size: x-small;
        margin: 0px auto;
        color: #777;
        margin-top: 7px;
    }

    .tk-lower {
        text-align: center;
        display: block;
        width: 100%;
        clear: both;
    }

    .tk-lower .ingintahu {
        font-size: 2.0000em; /* 24px */
        clear: both;
        width: 100%;
        margin: 0px auto;
        color: black;
        margin-top: 30px;
    }

    .tk-lower .tk-icons {
        clear: both;
        width: 100%;
        margin: 0px auto;
        display: block;
        margin-top: 21px;
    }

    .icon {
        background-size: 100% auto;
        height: 80px;
        width: 80px;
        margin: 0px 20px;
        display: inline-block;
    }

    .tk-headlines {
        text-align: center;
        width: 100%;
        margin-top: 32px;
    }
    .hl-title {
        font-size: 1.5000em; /* 18px */
        line-height: 1.0000em; /* 18px */
        margin-top: 8px;  margin-bottom: 0.0000em;
        color: White;
    }
    .hl-content {
        margin: 0px auto;
        border-top: 2px solid #106030;
        width: 80%;
        text-align: center;
        padding-top: 2px;
    }
    .hl-kegiatan {
        width: 360px;
        text-align: left;
        display : inline-block;
    }
    .hl-artikel {
        width: 360px;
        text-align: left;
        display : inline-block;
    }

    .keg-hl-img {
        float: left;
        height: 100px;
        width: 100px;
        border: solid 1px black;
        display: inline-block;
        margin-right: 1em;
        margin-top: 2.5px;
        background-color: gray;
    }
    .keg-hl-img:hover {
        border-color: red;
    }

    .keg-hl-list {
        height: 100px;
        display: inline-block;
    }

    .keg-hl-list ul {
        list-style-type: none;
        padding: 0;
        margin: 0;
        margin-top: 2px;
    }

    .keg-hl-list ul li {
        width: 20em;
        overflow: hidden;
        white-space: nowrap;
    }

    .art-hl-img {
        float: left;
        height: 100px;
        width: 100px;
        border: solid 1px black;
        display: inline-block;
        margin-right: 1em;
        margin-top: 2.5px;
        background-color: gray;
    }
    .art-hl-img:hover {
        border-color: red;
    }

    .art-hl-list {
        height: 100px;
        display: inline-block;    
    }

    .art-hl-list ul {
        list-style-type: none;
        padding: 0;
        margin: 0;
        margin-top: 2px;
    }

    .art-hl-list ul li {
        width: 20em;
        overflow: hidden;
        white-space: nowrap;
    }

</style>
<div class="tk-upper">
    <div class="tt1 tahukahkamu">Tahukah kamu?</div>
    <div class="tt2">terdapat <span class="jumlahkab"><?php echo count($kabList); ?> Kabupaten</span> di Indonesia</div>
    <div class="tt3">
        <!--yang masih <span class="kenapa">tertinggal dalam kesehatan.<sup>*</sup></span-->
        yang sedang <span class="kenapa">berjuang meningkatkan taraf kesehatan.<sup>*</sup></span>
        <?php $this->view("fbshare"); ?>
    </div>
</div>
<div class="tk-map"><div id="map"></div></div>
<div class="tk-catatan">*) daerah tertinggal dengan Indeks Pembangunan Manusia (IPM) dan Angka Harapan Hidup (AHH) dibawah standar nasional.</div>
<div class="tk-lower">
    <div class="ingintahu">Ingin tahu lebih banyak?</div>
    <div class="tk-icons">
        <a href="<?php echo site_url("artikel/berita"); ?>" title="Berita Perdesaan Sehat" class="icon artikel"><img src="<?php echo res_url("img/artikel_1 gelap.png"); ?>" /><img class="hidden" src="<?php echo res_url("img/artikel_1.png"); ?>" /></a>
        <a href="<?php echo site_url("kegiatan/berita"); ?>" title="Kegiatan Perdesaan Sehat" class="icon kegiatan"><img src="<?php echo res_url("img/kegiatan_2gelap.png"); ?>" /><img class="hidden" src="<?php echo res_url("img/kegiatan_2.png"); ?>" /></a>
        <a href="<?php echo site_url("tentangkami/pilarps"); ?>" title="5 Pilar Perdesaan Sehat" class="icon pilar"><img src="<?php echo res_url("img/5 pilar_3gelap.png"); ?>" /><img class="hidden" src="<?php echo res_url("img/5 pilar_3.png"); ?>" /></a>
        <a href="<?php echo site_url("data/statistik"); ?>" title="Profil Kesehatan Daerah Tertinggal" class="icon profildt"><img src="<?php echo res_url("img/profilgelap.png"); ?>" /><img class="hidden" src="<?php echo res_url("img/profil.png"); ?>" /></a>
        <a href="<?php echo site_url("artikel/pj"); ?>" title="Ikut Berkontribusi" class="icon kontribusi"><img src="<?php echo res_url("img/kontribusi_5gelap.png"); ?>" /><img class="hidden" src="<?php echo res_url("img/kontribusi_5.png"); ?>" /></a>
    </div>
</div>
<div class="tk-headlines">
    <div class="hl-content">
        <div class="hl-kegiatan">
            <div class="keg-content">
                <span class="keg-hl-list">
                    <span class="keg-title title">Kegiatan PS</span>
                    <ul>
                        <?php $i = 0; ?>
                        <?php foreach ($hlKegiatans as $kegiatan) { ?>
                            <li><a onMouseOver="javascript:hlKegUpdate(<?php echo $i; ?>);" href="<?php echo site_url("kegiatan/detail/" . $kegiatan->id); ?>"><?php echo $kegiatan->content_id->title; ?></a></li>
                            <?php $i++; ?>
                        <?php } ?>
                        <?php for ($i = 0; $i < (5 - count($hlKegiatans)); $i++) { ?>
                            <li><a href="javascript:void(0);">&nbsp;</a></li>
                            <?php $i++; ?>
                        <?php } ?>
                    </ul>
                </span>
                <span class="keg-hl-img">
                    <?php foreach ($hlKegiatans as $kegiatan) { ?>
                        <a href="<?php echo site_url("kegiatan/detail/" . $kegiatan->id); ?>"><img class="hidden" src="<?php echo $kegiatan->content_id->thumbnail_img->src; ?>" style="height: 100px; width: 100px;"/></a>
                    <?php } ?>
                    <?php for ($i = 0; $i < (5 - count($hlKegiatans)); $i++) { ?>
                        <a href="javascript:void(0);"><img class="hidden" src="#" style="height: 100px; width: 100px;"/></a>
                    <?php } ?>
                </span>
            </div>
        </div>
        <div class="hl-artikel">
            <div class="art-content">
                <span class="art-title title">Artikel PS</span>
                <span class="art-hl-img">
                    <?php $i = 0; ?>
                    <?php foreach ($hlKR as $kr) { ?>
                        <a href="<?php echo site_url("artikel/kr/" . $kr->id); ?>"><img class="hidden" src="<?php echo $kr->content_id->hlPicSrc; ?>" style="height: 100px; width: 100px;"/></a>
                    <?php } ?>
                    <?php for ($i = 0; $i < (2 - count($hlKR)); $i++) { ?>
                        <a href="javascript:void(0);"><img class="hidden" src="#" style="height: 100px; width: 100px;"/></a>
                    <?php } ?>
                    <?php foreach ($hlPJ as $pj) { ?>
                        <a href="<?php echo site_url("artikel/pj/" . $pj->id); ?>"><img class="hidden" src="<?php echo $pj->content_id->hlPicSrc; ?>" style="height: 100px; width: 100px;"/></a>
                    <?php } ?>
                    <?php for ($i = 0; $i < (2 - count($hlPJ)); $i++) { ?>
                        <a href="javascript:void(0);"><img class="hidden" src="#" style="height: 100px; width: 100px;"/></a>
                    <?php } ?>
                    <?php if ($hlBerita != NULL) { ?>
                        <a href="<?php echo site_url("artikel/berita/" . $hlBerita->id); ?>"><img class="hidden" src="<?php echo $hlBerita->content_id->hlPicSrc; ?>" style="height: 100px; width: 100px;"/></a>
                    <?php } else { ?>
                        <a href="javascript:void(0);"><img class="hidden" src="#" style="height: 100px; width: 100px;"/></a>
                    <?php } ?>
                </span>
                <span class="art-hl-list">            
                    <ul>
                        <?php $i = 0; ?>
                        <?php foreach ($hlKR as $kr) { ?>
                            <li>
                                <a onMouseOver="javascript:hlArtUpdate(<?php echo $i; ?>);" href="<?php echo site_url("artikel/kr/" . $kr->id); ?>"><?php echo $kr->content_id->title; ?></a>
                            </li>
                            <?php $i++; ?>
                        <?php } ?>
                        <?php for ($j = 0; $j < (2 - count($hlKR)); $j++) { ?>
                            <li><a href="javascript:void(0);">&nbsp;</a></li>
                            <?php $i++; ?>
                        <?php } ?>
                        <?php foreach ($hlPJ as $pj) { ?>
                            <li>
                                <a onMouseOver="javascript:hlArtUpdate(<?php echo $i; ?>);" href="<?php echo site_url("artikel/pj/" . $pj->id); ?>"><?php echo $pj->content_id->title; ?></a>
                            </li>
                            <?php $i++; ?>
                        <?php } ?>
                        <?php for ($j = 0; $j < (2 - count($hlPJ)); $j++) { ?>
                            <li><a href="javascript:void(0);">&nbsp;</a></li>
                            <?php $i++; ?>
                        <?php } ?>
                        <?php if ($hlBerita != NULL) { ?>
                            <li>
                                <a onMouseOver="javascript:hlArtUpdate(4);" href="<?php echo site_url("artikel/berita/" . $hlBerita->id); ?>"><?php echo $hlBerita->content_id->title; ?></a>
                            </li>
                        <?php } else { ?>
                            <li><a href="javascript:void(0);">&nbsp;</a></li>
                        <?php } ?>
                    </ul>
                </span>
            </div>
        </div>
    </div>
</div>
<div id="popupContainer" class="hidden">
    <h2 style="margin: 0px; margin-bottom: 5px;">Title</h2>
    <div class="content" style="padding: 0px;">content</div>
    <div class="link"><a>Info Detail...</a></div>
</div>
<script type="text/javascript">
                                var map, selectedFeature, selectControl;

                                jQuery(document).ready(function() {

                                    $(".tk-icons .icon").each(function() {
                                        $(this).hover(function() {
                                            $($(this).children("img")[0]).addClass("hidden");
                                            $($(this).children("img")[1]).removeClass("hidden");
                                        }, function() {
                                            $($(this).children("img")[1]).addClass("hidden");
                                            $($(this).children("img")[0]).removeClass("hidden");
                                        });
                                    });

                                    $(".keg-hl-list ul li").each(function() {
                                        $(this).prop("title", $(this).text().trim());
                                    });

                                    $(".art-hl-list ul li").each(function() {
                                        $(this).prop("title", $(this).text().trim());
                                    });

                                    hlKegUpdate(0);
                                    hlArtUpdate(0);

                                    map = createMapExplorer("map", true);

                                    // The overlay layer for our marker, with a simple diamond as symbol
                                    var overlay = new OpenLayers.Layer.Vector('Overlay', {
                                        styleMap: new OpenLayers.StyleMap({
                                            externalGraphic: '<?php echo res_url("img/marker.png"); ?>',
                                            graphicWidth: 20, graphicHeight: 24, graphicYOffset: -24,
                                            title: '${tooltip}'
                                        })
                                    });
                                    // control
                                    selectControl = new OpenLayers.Control.SelectFeature(overlay, {
                                        onSelect: onFeatureSelect,
                                        onUnselect: onFeatureUnselect,
                                        autoActivate: true
                                    });

                                    var kabList = [];
<?php
if (count($kabList) > 0) {
    echo "kabList = " . json_encode($kabList);
}
?>

                                    for (var i = 0; i < kabList.length; i++) {
                                        var kabLoc = new OpenLayers.Geometry.Point(kabList[i].longlatitude, kabList[i].latitude)
                                                .transform(map.displayProjection, map.projection);
                                        overlay.addFeatures([
                                            new OpenLayers.Feature.Vector(kabLoc, {tooltip: kabList[i].display_name, data: kabList[i]})
                                        ]);
                                    }
                                    map.addLayers([overlay]);
                                    map.addControl(selectControl);
                                    map.setCenter(new OpenLayers.LonLat(120, -2.5).transform(
                                            map.displayProjection,
                                            map.projection), 4);
                                });
                                function showFeatures() {
                                    var edLayer = map.getLayersByName("Editable")[0];
                                    var features = edLayer.features;
                                    $("#geocont").html("");
                                    for (var i = 0; i < features.length; i++) {
                                        $("#geocont").append(features[i].geometry.toString());
                                    }
                                }
                                function onPopupClose(evt) {
                                    selectControl.unselect(selectedFeature);
                                }
                                function onFeatureSelect(feature) {
                                    selectedFeature = feature;
                                    var kabupaten = feature.attributes.data;
                                    $("#popupContainer h2").text(kabupaten.display_name);
                                    $("#popupContainer .content").html(kabupaten.generated_summary);
                                    $("#popupContainer .link a").prop("href", "<?php echo site_url("profildt/detail/kab"); ?>/" + kabupaten.code);
                                    popup = new OpenLayers.Popup.FramedCloud("chicken",
                                            feature.geometry.getBounds().getCenterLonLat(), null,
                                            $("#popupContainer").html(),
                                            null, true, onPopupClose);
                                    popup.panMapIfOutOfView = false;
                                    feature.popup = popup;
                                    map.addPopup(popup);
                                }
                                function onFeatureUnselect(feature) {
                                    map.removePopup(feature.popup);
                                    feature.popup.destroy();
                                    feature.popup = null;
                                }

                                function hlKegUpdate(idx) {
                                    $(".keg-hl-img a").addClass("hidden");
                                    $($(".keg-hl-img a")[idx]).removeClass("hidden");
                                    $(".keg-hl-img a img").addClass("hidden");
                                    $($(".keg-hl-img a img")[idx]).removeClass("hidden");
                                    $(".keg-hl-list ul li").css("font-weight", "normal");
                                    $($(".keg-hl-list ul li")[idx]).css("font-weight", "bold");
                                }

                                function hlArtUpdate(idx) {
                                    $(".art-hl-img a").addClass("hidden");
                                    $($(".art-hl-img a")[idx]).removeClass("hidden");
                                    $(".art-hl-img a img").addClass("hidden");
                                    $($(".art-hl-img a img")[idx]).removeClass("hidden");
                                    $(".art-hl-list ul li").css("font-weight", "normal");
                                    $($(".art-hl-list ul li")[idx]).css("font-weight", "bold");
                                }

</script>